var foodService = require('../../service/o2o_client/food.server.service.js');
const winston = require("../../utils/winstonLogger.js");
// 解决中文乱码
const iconv = require("iconv-lite");

module.exports = {
    getFoodListByMerchantId: getFoodListByMerchantId,
    getFoodsByType: getFoodsByType,
    getFoodsByTypeAndMerchantId: getFoodsByTypeAndMerchantId
}


function getFoodListByMerchantId(req, res, next){
    winston.info("enter getFoodListByMerchantId......."+req.params.merchantId);
    foodService.getFoodListByMerchantId(req, res, next);
}

function getFoodsByType(req, res, next){
    let type = req.params.type;
    // let newType = iconv.decode(type, "gbk");
    winston.info("enter getFoodsByType........."+type);
    foodService.getFoodListByType(req, res, next);
}


function getFoodsByTypeAndMerchantId(req, res, next){
    foodService.getFoodsByTypeAndMerchantId(req, res, res, next);
}

// //foods/type/:type/merchantId/:merchantId